<?
class RedditApiBase
{
	public $Story;
	public $Subreddit;
	public $User;
	public function RedditApiBase($endpointRetriever)
	{
		$this->Story = new StoryApi($endpointRetriever);
		$this->Subreddit = new SubredditApi($endpointRetriever);
		$this->User = new UserApi($endpointRetriever);
	}
}
class StoryApi
{
	protected $endpointRetriever;
	public function StoryApi($endpointRetriever)
	{
		$this->endpointRetriever = $endpointRetriever;
	}
	public function GetStoriesHot($subreddit = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('hot', null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoriesNew($subreddit = null, $sort = null, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('new', null);
		$endpoint->AddOption('sort', $sort, null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoriesControversial($subreddit = null, $t = null, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('controversial', null);
		$endpoint->AddOption('t', $t, null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoriesTop($subreddit = null, $t = null, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('top', null);
		$endpoint->AddOption('t', $t, null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoriesById($ids, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('by_id', null);
		$endpoint->addPart($ids, null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoriesByUrl($url)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('api', null);
		$endpoint->addPart('info', null);
		$endpoint->AddOption('url', $url, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoryRelated($subreddit, $storyId, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('related', null);
		$endpoint->addPart($storyId, null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetStoryComments($subreddit, $storyId, $commentId = null, $sort = null, $all = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart($subreddit, 'r/%s');
		$endpoint->addPart('comments', null);
		$endpoint->addPart($storyId, null);
		$endpoint->addPart($commentId, 'comment/%s');
		$endpoint->AddOption('sort', $sort, null);
		$endpoint->AddOption('all', $all, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function VoteUp($id, $uh, $reddit_session)
	{
		$endpoint = new Endpoint('POST');
		$endpoint->addPart('api', null);
		$endpoint->addPart('vote', null);
		$endpoint->AddOption('dir', '1', null);
		$endpoint->AddOption('id', $id, null);
		$endpoint->AddOption('uh', $uh, null);
		$endpoint->AddCookie('reddit_session', $reddit_session, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function VoteDown($id, $uh, $reddit_session)
	{
		$endpoint = new Endpoint('POST');
		$endpoint->addPart('api', null);
		$endpoint->addPart('vote', null);
		$endpoint->AddOption('dir', '-1', null);
		$endpoint->AddOption('id', $id, null);
		$endpoint->AddOption('uh', $uh, null);
		$endpoint->AddCookie('reddit_session', $reddit_session, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function VoteNeutral($id, $uh, $reddit_session)
	{
		$endpoint = new Endpoint('POST');
		$endpoint->addPart('api', null);
		$endpoint->addPart('vote', null);
		$endpoint->AddOption('dir', '0', null);
		$endpoint->AddOption('id', $id, null);
		$endpoint->AddOption('uh', $uh, null);
		$endpoint->AddCookie('reddit_session', $reddit_session, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
}
class SubredditApi
{
	protected $endpointRetriever;
	public function SubredditApi($endpointRetriever)
	{
		$this->endpointRetriever = $endpointRetriever;
	}
	public function GetSubreddits($after = null, $before = null, $search = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('reddits', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		$endpoint->AddOption('search', $search, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
}
class UserApi
{
	protected $endpointRetriever;
	public function UserApi($endpointRetriever)
	{
		$this->endpointRetriever = $endpointRetriever;
	}
	public function GetUserSubmitted($userName, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('submitted', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetUserLiked($userName, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('liked', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetUserDisliked($userName, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('disliked', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetUserHidden($userName, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('hidden', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetUserComments($userName, $after = null, $before = null)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('comments', null);
		$endpoint->AddOption('after', $after, null);
		$endpoint->AddOption('before', $before, null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
	public function GetUser($userName)
	{
		$endpoint = new Endpoint('GET');
		$endpoint->addPart('user', null);
		$endpoint->addPart($userName, null);
		$endpoint->addPart('about', null);
		return $this->endpointRetriever->retrieveEndpoint($endpoint);
	}
}
